<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/view/common/tag.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>聊天机器人展览系统</title>
    <link rel="stylesheet" href="${baseurl}/lib/layui/css/layui.css">
    <link rel="stylesheet" href="${baseurl}/css/portal/global.css">
</head>
<body>
<jsp:include page="header.jsp"></jsp:include>

<div class="layui-container" style="margin-top: 15px">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="fly-panel" style="height: 400px">
                <input type="hidden" id="galleryId" name="id" value="${galleryInfo.id}">
                <div class="layui-col-md6" style="display: flex;justify-content: center;padding-top: 50px;">
                    <img height="300px" src="${galleryInfo.galleryImage}" alt="艺术馆图片"/>
                </div>

                <div class="layui-col-md6">
                    <div style="color: #666; padding-top: 10px;line-height: 28px; margin-bottom: 5px;font: 700 16px Arial,'microsoft yahei' ">${galleryInfo.galleryName}</div>
                    <div style="color: #666; padding-top: 10px;line-height: 28px; margin-bottom: 5px;font: 700 16px Arial,'microsoft yahei'">${galleryInfo.gallerySummary}</div>
                </div>
            </div>

            <div class="fly-panel" style="margin-bottom: 0;">

                <%--<ul class="fly-list" id="LAY_content">--%>
                <%--</ul>--%>
                    <div class="layui-tab-content" style="padding: 20px 0;">
                    <div class="layui-tab-item layui-show">
                        <ul class="mine-view jie-row" id="LAY_content">

                        </ul>
                        <div id="LAY_page"></div>
                    </div>
                    </div>
                <!-- <div class="fly-none">没有相关数据</div> -->

                <div style="text-align: center" id="LAY-page">
                </div>

            </div>
        </div>
    </div>
</div>

<div class="fly-footer">
    <p>FUN 2021 &copy; FUN.com 出品</p>
</div>


<script id="LAY_tpl" type="text/html">
    {{#
    var calcu = function(str1,str2) {
    return str1-str2;
    }
    }}
    {{# layui.each(d, function(index, item){ }}

    <li>
        <input type="hidden" id="exhibitionId"  value="{{item.id}}">
        <a class="jie-title" style="margin-left: 15px" href="javascript:;" onclick="btnReplyClick(this)"  title="{{item.exhibitionSummary}}">{{item.exhibitionName}}</a>
        <i>{{item.exhibitionSummary}}</i>
        <i>{{item.exhibitionTime}}</i>
        <em style="margin-right: 10px;">可预约:{{item.appointAmount}}</em>
    </li>
    {{# }); }}
    {{# if(d.length === 0){ }}
    暂无展览馆
    {{# } }}
</script>

<script type="text/javascript" src="${baseurl}/lib/layui/layui.js"></script>
<script type="text/javascript" src="${baseurl}/lib/layui_custom/Hlayui.js"></script>
<script>
    layui.use(['layer', 'laytpl', 'form','laypage','element','layerCustom'], function () {
        var $ =layui.jquery;
        var layer = layui.layer;
        var laytpl = layui.laytpl;
        var form = layui.form;
        var layerCustom = layui.layerCustom;
        var element = layui.element;
        var laypage = layui.laypage;
        $(function () {
            init();
        })
        // ()();
        function init() {
            $.get(BaseUrl+'portal/exhibitionInfo/list', {page: 1, limit: 10}, function (res) {
                renderList(res.data);
                var total = res.count;
                pageColumn(total);
            })
        }
        /*列表渲染*/
        var renderList = function (data) {
            var getTpl = document.getElementById("LAY_tpl").innerHTML;
            laytpl(getTpl).render(data, function (html) {
                document.getElementById("LAY_content").innerHTML = html;
            });
        }
        /*分页插件渲染*/
        var pageColumn = function (total) {

            laypage.render({
                elem: 'LAY-page'
                , count: total
                , jump: function (obj, first) {
                    if (!first) {
                        getPage(obj.curr, obj.limit);
                    }
                }
            });
        };

        var getPage = function (page, limit) {
            $.get(BaseUrl+'portal/exhibitionInfo/list', {page: page, limit: limit}, function (res) {
                renderList(res.data);
            })
        }

        $(".mine-edit").on('click',function () {
            //验证是否登录
            var loginUrl = BaseUrl+"user/checkIsExist";
            $.get(loginUrl,null,function (result) {
                if (result.success) {
                    //打开一个页面
                    layerCustom.open("添加展览", BaseUrl + 'portal/exhibitionInfo/add', "700px", "550px", function (layero, index) {

                    });
                }else {
                    layerCustom.yellowQuestionMsg("用户未登录，即将跳转到登录页面",function () {
                        window.top.location.href = BaseUrl +"portal/login";
                    })
                }
            },json);

        })

       window.btnReplyClick = function(ele) {
            var exhibitionId = $("#exhibitionId").val();
           var loginUrl = BaseUrl+"user/checkIsExist";
           $.get(loginUrl,null,function (result) {
               if (result.success) {
                   //打开一个页面
                   layerCustom.open("添加展览", BaseUrl + 'portal/exhibitionInfo/add?id='+exhibitionId, "400px", "450px", function (layero, index) {

                   }, function () {
                       init();
                   });
               }else {
                   layerCustom.yellowQuestionMsg("用户未登录，即将跳转到登录页面",function () {
                       window.top.location.href = BaseUrl +"portal/login";
                   })
               }
           },"json");
        }


    });



</script>

</body>
</html>
